﻿using System;
using System.Threading.Tasks;

namespace Sustainalytics.LongRunningTaskManager.Interface
{
    /// <summary>
    /// Instance of a Long Running Task as seen by the Task Manager.
    /// </summary>
    public interface ILongRunningTaskInstance
    {
        /// <summary>
        /// Task instance ID.
        /// </summary>
        string Id { get; }

        /// <summary>
        /// Task instance title.
        /// </summary>
        string Title { get; }

        /// <summary>
        /// Task context.
        /// </summary>
        LongRunningTaskContext TaskContext { get; }

        /// <summary>
        /// Managed task associated to current task instance.
        /// </summary>
        Task<ILongRunningTaskResult> ManagedTask { get; }

        /// <summary>
        /// Result of current task instance.
        /// </summary>
        ILongRunningTaskResult Result { get; }

        /// <summary>
        /// Status of current task instance.
        /// </summary>
        LongRunningTaskInstanceStatus Status { get; }

        /// <summary>
        /// Task type.
        /// </summary>
        LongRunningTaskTypeEnum Type { get; }

        /// <summary>
        /// Date when current task instance was created.
        /// </summary>
        DateTime DateCreated { get; }

        /// <summary>
        /// Order of occurence.
        /// </summary>
        long Order { get; }

        /// <summary>
        /// Task result processing stages.
        /// </summary>
        ILongRunningTaskResultTransformer TaskResultProcess { get; }

        /// <summary>
        /// Async info.
        /// </summary>
        ILongRunningTaskInstanceAsyncInfo AsyncInfo { get; }


        /// <summary>
        /// Start task.
        /// </summary>
        void Start();
    }
}
